#lang r5rs
(define (f-exp b n)
  (define (even? x) (= 0 (remainder x 2)))
  (define (f-e b n sum)
    (cond ((= 1 n) sum)
          ((even? n) (f-e b (/ n 2) (* sum sum)))
          (else (f-e b (- n 1) (* sum b)))))
  (f-e b n b))
(f-exp 9 81)